package com.admin.boot.common.utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @version v3.0
 * @Description: TODO
 * @author: jeecg-boot
 * @date: 2024-01-10
 */
public class FieldType {

    public static final Map<String,String> fieldTypeMap = new HashMap<>();

    public static final Map<String,Integer> fieldTypeLengthMap = new HashMap<>();

    public static final Map<String,Integer> fieldTypeDecimalLengthMap = new HashMap<>();


    public static final List<String> hasNoLengthFieldTypeList = new ArrayList<>();

    public static final List<String> hasDecimalLengthFieldTypeList = new ArrayList<>();


    static {
        fieldTypeMap.put("String", "varchar");
        fieldTypeMap.put("Integer", "int");
        fieldTypeMap.put("Long", "bigint");
        fieldTypeMap.put("Double", "double");
        fieldTypeMap.put("Date", "datetime");
        fieldTypeMap.put("BigDecimal", "decimal");
        fieldTypeMap.put("Text","text");

        fieldTypeLengthMap.put("String", 255);
        fieldTypeLengthMap.put("Integer", 10);
        fieldTypeLengthMap.put("Long", 19);
        fieldTypeLengthMap.put("Double",  10);
        fieldTypeLengthMap.put("BigDecimal", 20);
        fieldTypeLengthMap.put("Text",500);

        fieldTypeDecimalLengthMap.put("Double",  5);
        fieldTypeDecimalLengthMap.put("BigDecimal", 10);


        hasNoLengthFieldTypeList.add("datetime");
        hasNoLengthFieldTypeList.add("int");

        hasDecimalLengthFieldTypeList.add("decimal");
        hasDecimalLengthFieldTypeList.add("double");
    }

}
